﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace CID.Tests.Support.Configuration.Database
{
    public class InitializationConfiguration : ConfigurationSection
    {
        private const string DatabaseScriptsBasePathAttribute = "databaseScriptsBasePath";
        private const string IsLocalDatabaseAttribute = "isLocalDatabase";
        private const string InitializationVariablesElement = "initializationVariables";
        
        [ConfigurationProperty(DatabaseScriptsBasePathAttribute, IsRequired = true)]
        public string DatabaseScriptsBasePath
        {
            get { return (string)this[DatabaseScriptsBasePathAttribute]; }
        }

        [ConfigurationProperty(IsLocalDatabaseAttribute, IsRequired = true, DefaultValue=true)]
        public bool IsLocalDatabase
        {
            get { return (bool)this[IsLocalDatabaseAttribute]; }
        }

        [ConfigurationProperty(InitializationVariablesElement,IsDefaultCollection=false)]
        [ConfigurationCollection(typeof(InitializationVariableCollection), AddItemName="add", ClearItemsName="clear", RemoveItemName="remove")]
        public InitializationVariableCollection InitializationVariables
        {
            get { return (InitializationVariableCollection)this[InitializationVariablesElement]; }
        }
    }
}
